package tp;

import static org.junit.Assert.*;

import org.junit.Test;
import org.junit.Before;
import org.junit.After;
import org.junit.Ignore;

import tp.Liczba.LiczbaException;

public class LiczbaTest4 {

	Liczba n;
	String zapis;
	
	@Before
	public void before() {
		zapis = "";
	}
	
	@Test(expected = LiczbaException.class)
	public void testLiczbaStringInt() {
		n = new Liczba("FF",20);
	}

	@Test
	public void testZapis() {
		n = new Liczba("FA",16); 
		zapis = n.zapis(10);
		assertEquals(zapis,"255");
	}
	
	@Test
	public void Decimal_To_Hex_Equals_Expected_Result_True(){
		int chosenNumber = 29;
		n = new Liczba(chosenNumber);
		String expectedResult = "1D";
		
		assertEquals(expectedResult, n.zapis(16));
	}

	@Test(timeout=1000)
	public void testTimeout() {
		n = new Liczba("FFFF",16);
	}
	
	@After
	public void after() {
		zapis = null;
		n = null;
	}
	
	@Ignore
	public void testLiczbaString() {
		n = new Liczba("FFFF",20);
	}
}
